#include "drawcomponment.h"

DrawComponment::DrawComponment(QAxObject* modelSpace,std::map<QString,QString>* tableData,int wndNum)
{
    this->pModelSpace = modelSpace;
    this->windowData = tableData;
    this->windowNum = wndNum;
}

//画上下板单体
QVariantList DrawComponment::DrawSingleBoard(QPointF startPoint,int view,int pos)
{
    float boardLength = windowData->find("IDC_UPPER_BOARD_LENGTH")->second.toFloat();
    float boardWidth = windowData->find("IDC_UPPER_BOARD_WIDTH")->second.toFloat();
    float boardHeight = windowData->find("IDC_UPPER_BOARD_HEIGHT")->second.toFloat();
    float boardSlotWidth = windowData->find("IDC_UPPER_BOARD_SLOT_WIDTH")->second.toFloat();
    float boardSlotDept = windowData->find("IDC_UPPER_BOARD_SLOT_DEPT")->second.toFloat();
    float width = boardLength;float height = boardWidth;
    QVariantList Point;
    switch(view)
    {
    case 0:
        return Point;
    case 1:
        return Point;
    case 2:
        Point = {
                startPoint.x(),startPoint.y(),0.0,
                startPoint.x() + (float)pos * boardHeight,startPoint.y(),0.0,
                startPoint.x() + (float)pos * boardHeight,startPoint.y() + (float)pos * (boardWidth - boardSlotWidth) ,0.0,
                startPoint.x() + (float)pos * (boardHeight - boardSlotDept),startPoint.y() + (float)pos * (boardWidth - boardSlotWidth) ,0.0,
                startPoint.x() + (float)pos * (boardHeight - boardSlotDept),startPoint.y() + (float)pos * boardWidth ,0.0,
                startPoint.x(),startPoint.y() + (float)pos * boardWidth ,0.0
        };
        return Point;
    default:
        return Point;
    }
}
//画L框单体
QVariantList DrawComponment::DrawDoubleLSlot(QPointF startPoint,int view,int pos)
{
    //初始化数据
    float upperLBoardLength = windowData->find("IDC_UPPER_LBOARD_LENGTH")->second.toFloat();
    float leftLBoardLength = windowData->find("IDC_LEFT_LBOARD_LENGTH")->second.toFloat();
    float rightLBoardLength = windowData->find("IDC_RIGHT_LBOARD_LENGTH")->second.toFloat();

    float upperLBoardWidth = windowData->find("IDC_UPPER_LBOARD_WIDTH")->second.toFloat();
    //float leftLBoardWidth = windowData->find("IDC_LEFT_LBOARD_WIDTH")->second.toFloat();
    //float rightLBoardWidth = windowData->find("IDC_RIGHT_LBOARD_WIDTH")->second.toFloat();

    float upperLBoardHeight = windowData->find("IDC_UPPER_LBOARD_HEIGHT")->second.toFloat();
    //float leftLBoardHeight = windowData->find("IDC_LEFT_LBOARD_HEIGHT")->second.toFloat();
    //float rightLBoardHeight = windowData->find("IDC_RIGHT_LBOARD_HEIGHT")->second.toFloat();


    float upperBoardLength = windowData->find("IDC_UPPER_BOARD_LENGTH")->second.toFloat();
    float lowerBoardLength = windowData->find("IDC_LOWER_BOARD_LENGTH")->second.toFloat();
    float bladeLength = windowData->find("IDC_BLADE_LENGTH")->second.toFloat();
    float invisPullRod1Length = windowData->find("IDC_INVIS_PULL_ROD1_LENGTH")->second.toFloat();


    float upperBoardWidth = windowData->find("IDC_UPPER_BOARD_WIDTH")->second.toFloat();
    float lowerBoardWidth = windowData->find("IDC_LOWER_BOARD_WIDTH")->second.toFloat();
    float bladeWidth = windowData->find("IDC_BLADE_WIDTH")->second.toFloat();
    float invisPullRod1Width = windowData->find("IDC_INVIS_PULL_ROD1_WIDTH")->second.toFloat();


    float upperBoardHeight = windowData->find("IDC_UPPER_BOARD_HEIGHT")->second.toFloat();
    float lowerBoardHeight = windowData->find("IDC_LOWER_BOARD_HEIGHT")->second.toFloat();
    float bladeHeight = windowData->find("IDC_BLADE_HEIGHT")->second.toFloat();
    float invisPullRod1Height = windowData->find("IDC_INVIS_PULL_ROD1_HEIGHT")->second.toFloat();

    float lboardSlotWidth = windowData->find("IDC_LBOARD_SLOT_WIDTH")->second.toFloat();
    float lboardSlotDept = windowData->find("IDC_LBOARD_SLOT_DEPT")->second.toFloat();

    float lboardLHeight = windowData->find("IDC_LBOARD_LHEIGHT")->second.toFloat();
    QVariantList Point;
    switch(view)
    {
    case 0:
        Point = {
            startPoint.x(),startPoint.y(),0.0, //1
            startPoint.x() + (float)pos * upperLBoardWidth,startPoint.y(),0.0,//2
            startPoint.x() + (float)pos * upperLBoardWidth,startPoint.y() + (lboardLHeight-lboardSlotWidth) / 2.0,0.0, //3
            startPoint.x() + (float)pos * upperLBoardWidth - ((float)pos * lboardSlotWidth),startPoint.y() + (lboardLHeight-lboardSlotWidth) / 2.0,0.0, //4
            startPoint.x() + (float)pos * upperLBoardWidth - ((float)pos * lboardSlotWidth),startPoint.y() + (lboardLHeight-lboardSlotWidth) / 2.0 + lboardSlotWidth,0.0, //5
            startPoint.x() + (float)pos * upperLBoardLength,startPoint.y() + (lboardLHeight-lboardSlotWidth) / 2.0 + lboardSlotWidth,0.0,//6
            startPoint.x() + (float)pos * upperLBoardLength,startPoint.y() + (lboardLHeight-lboardSlotWidth) + lboardSlotWidth  ,0.0,//7
            startPoint.x() + (float)pos * upperLBoardLength + (float)pos *  lboardSlotDept,startPoint.y() + lboardLHeight ,0.0,//8
            startPoint.x() + (float)pos * upperLBoardLength + (float)pos *  lboardSlotDept,startPoint.y() + upperLBoardHeight ,0.0,//9
            startPoint.x() + (float)pos * ((lboardLHeight-lboardSlotWidth) / 2.0 + lboardSlotWidth) + (float)pos *  lboardSlotDept,startPoint.y() + upperLBoardHeight ,0.0,//10
            startPoint.x() + (float)pos * ((lboardLHeight-lboardSlotWidth) / 2.0 + lboardSlotWidth) + (float)pos *  lboardSlotDept,startPoint.y() + upperLBoardHeight - lboardSlotDept ,0.0, //11
            startPoint.x() + (float)pos * (lboardSlotWidth / 2.0) ,startPoint.y() + upperLBoardHeight - lboardSlotDept ,0.0,//12
            startPoint.x() + (float)pos * (lboardSlotWidth / 2.0),startPoint.y() + upperLBoardHeight ,0.0,//13
            startPoint.x(),startPoint.y() + upperLBoardHeight ,0.0//14
        };
        return Point;
    case 1:
        return Point;
    case 2:
        if(windowNum <= 1)
        {
            Point = {
                startPoint.x(),startPoint.y(),0.0, //1
                startPoint.x() + upperLBoardHeight,startPoint.y(),0.0,//2
                startPoint.x() + upperLBoardHeight,startPoint.y() + ((lboardLHeight - lboardSlotWidth) / 2.0),0.0,//3
                startPoint.x() + upperLBoardHeight - lboardSlotDept,startPoint.y() + ((lboardLHeight - lboardSlotWidth) / 2.0),0.0,//4
                startPoint.x() + upperLBoardHeight - lboardSlotDept,startPoint.y() + ((lboardLHeight - lboardSlotWidth) / 2.0) + lboardSlotWidth,0.0,//5
                startPoint.x() + upperLBoardHeight ,startPoint.y() + ((lboardLHeight - lboardSlotWidth) / 2.0) + lboardSlotWidth,0.0,//6
                startPoint.x() + upperLBoardHeight ,startPoint.y() + lboardLHeight,0.0,//7
                startPoint.x() + lboardLHeight ,startPoint.y() + lboardLHeight,0.0,//8
                startPoint.x() + lboardLHeight ,startPoint.y() + upperLBoardWidth,0.0,//9
                startPoint.x() + lboardSlotWidth+((lboardLHeight - lboardSlotWidth) / 2.0) ,startPoint.y() + upperLBoardWidth,0.0,//10
                startPoint.x() + lboardSlotWidth+((lboardLHeight - lboardSlotWidth) / 2.0) ,startPoint.y() + upperLBoardWidth - lboardSlotDept,0.0,//11
                startPoint.x() + ((lboardLHeight - lboardSlotWidth) / 2.0) ,startPoint.y() + upperLBoardWidth - lboardSlotDept,0.0,//12
                startPoint.x() + ((lboardLHeight - lboardSlotWidth) / 2.0) ,startPoint.y() + upperLBoardWidth,0.0,//13
                startPoint.x() ,startPoint.y() + upperLBoardWidth,0.0//14
            };
        }
        else
        {
            Point = {
                startPoint.x(),startPoint.y(),0.0, //1
                startPoint.x() + upperLBoardHeight,startPoint.y(),0.0,//2
                startPoint.x() + upperLBoardHeight,startPoint.y() + (float)pos * lboardLHeight,0.0,//3
                startPoint.x() + lboardLHeight,startPoint.y() +(float)pos *  lboardLHeight,0.0,//4
                startPoint.x() + lboardLHeight,startPoint.y() +(float)pos *  upperLBoardWidth,0.0,//5
                startPoint.x() + ((lboardLHeight + lboardSlotWidth) / 2.0),startPoint.y() +(float)pos *  upperLBoardWidth,0.0,//6
                startPoint.x() + ((lboardLHeight + lboardSlotWidth) / 2.0) ,startPoint.y() + (float)pos *  (upperLBoardWidth - lboardSlotDept),0.0,//7
                startPoint.x() + ((lboardLHeight - lboardSlotWidth) / 2.0) ,startPoint.y() + (float)pos *  (upperLBoardWidth - lboardSlotDept),0.0,//8
                startPoint.x() + ((lboardLHeight - lboardSlotWidth) / 2.0)  ,startPoint.y() + (float)pos * upperLBoardWidth,0.0,//9
                startPoint.x() ,startPoint.y() + (float)pos * upperLBoardWidth,0.0,//10
            };
        }
        return Point;
    default:
        return Point;
    }
}

//画门边单体
QVariantList DrawComponment::DrawSingleEdge(QPointF startPoint,int view,int pos,int type)
{
    float upperBoardLength = windowData->find("IDC_UPPER_BOARD_LENGTH")->second.toFloat();

    float plainEdgeLength = windowData->find("IDC_PLAIN_EDGE_LENGTH")->second.toFloat();
    float hidePlainEdgeLength = windowData->find("IDC_HIDE_PLAIN_EDGE_LENGTH")->second.toFloat();

    float plainEdgeWidth = windowData->find("IDC_PLAIN_EDGE_WIDTH")->second.toFloat();
    float hidePlainEdgeWidth = windowData->find("IDC_HIDE_PLAIN_EDGE_WIDTH")->second.toFloat();

    float plainEdgeHeight = windowData->find("IDC_PLAIN_EDGE_HEIGHT")->second.toFloat();
    float hidePlainEdgeHeight = windowData->find("IDC_HIDE_PLAIN_EDGE_HEIGHT")->second.toFloat();


    //补充
    float plainCoverEdgeWidth = windowData->find("IDC_PLAIN_COVER_EDGE_WIDTH")->second.toFloat();
    float hideCoverEdgeWidth = windowData->find("IDC_HIDE_COVER_EDGE_WIDTH")->second.toFloat();

    float plainCoverEdgeHeight = windowData->find("IDC_PLAIN_COVER_EDGE_HEIGHT")->second.toFloat();
    float hideCoverEdgeHeight = windowData->find("IDC_HIDE_COVER_EDGE_HEIGHT")->second.toFloat();

    float hidePlainEdgeSlotWidth = windowData->find("IDC_HIDE_PLAIN_EDGE_SLOT_WIDTH")->second.toFloat();

    float hidePlainEdgeSlotDept = windowData->find("IDC_HIDE_PLAIN_EDGE_SLOT_DEPT")->second.toFloat();
    float hideCoverEdgeCoverMaxWidth = windowData->find("IDC_HIDE_COVER_EDGE_COVER_MAX_WIDTH")->second.toFloat();
    float hideCoverEdgeCoverMaxHeight = windowData->find("IDC_HIDE_COVER_EDGE_COVER_MAX_HEIGHT")->second.toFloat();
    //float hideCoverEdgeCoverBumpLength = windowData->find("IDC_HIDE_COVER_EDGE_COVER_BUMP_LENGTH")->second.toFloat();
    float plainCoverEdgeCoverMaxWidth = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_MAX_WIDTH")->second.toFloat();
    float plainCoverEdgeCoverMaxHeight = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_MAX_HEIGHT")->second.toFloat();
   // float plainCoverEdgeCoverBumpLength = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_BUMP_LENGTH")->second.toFloat();
    float lboardLHeight = windowData->find("IDC_LBOARD_LHEIGHT")->second.toFloat();
    //20250325
    float HideCoverEdgerCoverWidth = windowData->find("IDC_HIDE_COVER_EDGE_COVER_WIDTH")->second.toFloat();
    float PlainCoverEdgerCoverWidth = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_WIDTH")->second.toFloat();
    //
    float windowNum = windowData->find("IDC_WINDOW_NUM")->second.toInt();
    float windowWidth = windowData->find("IDC_WINDOW_WIDTH")->second.toFloat();

    QVariantList Point;
    switch(view)
    {
    case 0:
        if(type == 0)
        {
            Point = {
                startPoint.x(),startPoint.y(),0.0, //1
                startPoint.x() + (float)pos * hidePlainEdgeWidth,startPoint.y(),0.0, //2
                startPoint.x() + (float)pos * hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0, //3
                startPoint.x()  - (float)pos * (hidePlainEdgeWidth - hidePlainEdgeSlotDept),startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0, //4
                startPoint.x()  - (float)pos * (hidePlainEdgeWidth - hidePlainEdgeSlotDept),startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0, //5
                startPoint.x()  + (float)pos * hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0, //6
                startPoint.x()  + (float)pos * hidePlainEdgeWidth,startPoint.y() + hidePlainEdgeHeight,0.0, //7
                startPoint.x(),startPoint.y() + hidePlainEdgeHeight,0.0, //8
            };
        }
        else if (type == 1)
        {
            Point = {
                startPoint.x() ,startPoint.y(),0.0
            };
        }
        else if(type ==2)
        {
            Point = {
                startPoint.x(),startPoint.y(),0.0, //1
                startPoint.x() + (float)pos * hideCoverEdgeWidth,startPoint.y(),0.0,//2
                startPoint.x() + (float)pos * hideCoverEdgeWidth,startPoint.y() + (hideCoverEdgeHeight-hidePlainEdgeSlotWidth) / 2.0,0.0, //3
                startPoint.x() + (float)pos * (hideCoverEdgeWidth - hidePlainEdgeSlotDept),startPoint.y() + (hideCoverEdgeHeight-hidePlainEdgeSlotWidth) / 2.0,0.0, //4
                startPoint.x() + (float)pos * (hideCoverEdgeWidth - hidePlainEdgeSlotDept),startPoint.y() +  (hideCoverEdgeHeight-hidePlainEdgeSlotWidth) / 2.0+ hidePlainEdgeSlotDept,0.0, //5
                startPoint.x() + (float)pos * hideCoverEdgeWidth,startPoint.y() +  (hideCoverEdgeHeight-hidePlainEdgeSlotWidth) / 2.0+ hidePlainEdgeSlotDept,0.0,//6
                startPoint.x() + (float)pos * hideCoverEdgeWidth,startPoint.y() +hideCoverEdgeWidth,0.0,//7
                startPoint.x() + (float)pos * (HideCoverEdgerCoverWidth - (hideCoverEdgeCoverMaxWidth - hideCoverEdgeWidth)) ,startPoint.y() + hideCoverEdgeWidth ,0.0,//8
                startPoint.x() + (float)pos * (HideCoverEdgerCoverWidth - (hideCoverEdgeCoverMaxWidth - hideCoverEdgeWidth)) ,startPoint.y() + hideCoverEdgeCoverMaxHeight ,0.0,//9
                startPoint.x() - (float)pos * (hideCoverEdgeCoverMaxWidth - hideCoverEdgeWidth) ,startPoint.y() + hideCoverEdgeCoverMaxHeight ,0.0,//10
                startPoint.x() - (float)pos * (hideCoverEdgeCoverMaxWidth - hideCoverEdgeWidth),startPoint.y() + hideCoverEdgeWidth ,0.0//11
            };
        }
        else if(type ==3)
        {
            Point = {
                startPoint.x(),startPoint.y(),0.0, //1
                startPoint.x()  + (float)pos * plainCoverEdgeWidth,startPoint.y(),0.0, //2
                startPoint.x()  + (float)pos * plainCoverEdgeWidth,startPoint.y() + plainCoverEdgeHeight,0.0, //3
                startPoint.x()  + (float)pos *plainCoverEdgeCoverMaxWidth,startPoint.y() + plainCoverEdgeHeight,0.0, //4
                startPoint.x() + (float)pos *plainCoverEdgeCoverMaxWidth,startPoint.y() + plainCoverEdgeCoverMaxHeight,0.0, //5
                startPoint.x()  + (float)pos * (plainCoverEdgeCoverMaxWidth - PlainCoverEdgerCoverWidth) ,startPoint.y()+ plainCoverEdgeCoverMaxHeight ,0.0, //6
                startPoint.x()  + (float)pos * (plainCoverEdgeCoverMaxWidth - PlainCoverEdgerCoverWidth) ,startPoint.y() + plainCoverEdgeHeight,0.0, //7
                startPoint.x() ,startPoint.y() + plainCoverEdgeHeight,0.0 //8
            };
        }
        else
        {
        }
        return Point;
    case 1:
        return Point;
    case 2:
        return Point;
    default:
        return Point;
    }

}

//画L框整体
void DrawComponment::DrawLBoard(QPointF startPoint,int view)
{
    //初始化数据
    float upperLBoardLength = windowData->find("IDC_UPPER_LBOARD_LENGTH")->second.toFloat();
    float leftLBoardLength = windowData->find("IDC_LEFT_LBOARD_LENGTH")->second.toFloat();
    float rightLBoardLength = windowData->find("IDC_RIGHT_LBOARD_LENGTH")->second.toFloat();
    float upperLBoardWidth = windowData->find("IDC_UPPER_LBOARD_WIDTH")->second.toFloat();
    float upperBoardLength = windowData->find("IDC_UPPER_BOARD_LENGTH")->second.toFloat();
    float upperBoardWidth = windowData->find("IDC_UPPER_BOARD_WIDTH")->second.toFloat();
    float lboardLHeight = windowData->find("IDC_LBOARD_LHEIGHT")->second.toFloat();
    QAxObject* pPolyline;
    //
    QVariantList LBoardStartPoint,LBoardEndPoint;
    int pos = 1;
    switch(view)
    {
    case 0:
        //画轮廓线
        //画左
        LBoardStartPoint = DrawDoubleLSlot(startPoint,0,1);
        pModelSpace->querySubObject("AddPolyline(VerticesList)", LBoardStartPoint);
        //pPolyline->setProperty("Closed",true);
        //画线1
        LBoardStartPoint = {startPoint.x(),startPoint.y(),0.0};
        LBoardEndPoint = {startPoint.x() + upperBoardLength,startPoint.y(),0.0};
        pModelSpace->dynamicCall("AddLine(Variant, Variant)", LBoardStartPoint,LBoardEndPoint);

        //画线2
        LBoardStartPoint = {startPoint.x()+ upperBoardWidth,startPoint.y() + lboardLHeight,0.0};
        LBoardEndPoint = {startPoint.x() + (upperLBoardLength-2.0 * upperLBoardWidth) ,startPoint.y() + lboardLHeight,0.0};
        pModelSpace->dynamicCall("AddLine(Variant, Variant)", LBoardStartPoint,LBoardEndPoint);

        //画右
        startPoint = QPointF(startPoint.x() + upperLBoardLength,startPoint.y());
        LBoardStartPoint = DrawDoubleLSlot(startPoint,0,-1);
        pModelSpace->dynamicCall("AddPolyline(VerticesList)",LBoardStartPoint);
        //pPolyline->setProperty("Closed",true);

        break;
    case 1:
        //画上框
        LBoardStartPoint = {
            startPoint.x(),startPoint.y(),0.0,//1
            startPoint.x() + upperLBoardLength,startPoint.y(),0.0,//2
            startPoint.x() + upperLBoardLength - lboardLHeight,startPoint.y() + lboardLHeight,0.0,//3
            startPoint.x() + lboardLHeight,startPoint.y() + lboardLHeight,0.0 //4
        };
        pModelSpace->dynamicCall("AddPolyline(VerticesList)", LBoardStartPoint);
        //pPolyline->setProperty("Closed",true);
        //画左框
        LBoardStartPoint = {
            startPoint.x(),startPoint.y(),0.0,//1
            startPoint.x(),startPoint.y() + leftLBoardLength,0.0,//2
            windowNum <= 1 ? startPoint.x() + lboardLHeight,startPoint.y() + leftLBoardLength:startPoint.x() + lboardLHeight,startPoint.y() + leftLBoardLength - lboardLHeight,0.0,//3
            startPoint.x() + lboardLHeight,startPoint.y() + lboardLHeight,0.0 //4
        };
        pModelSpace->dynamicCall("AddPolyline(VerticesList)", LBoardStartPoint);
        //pPolyline->setProperty("Closed",true);
        //画右框
        LBoardStartPoint = {
            startPoint.x() + upperLBoardLength,startPoint.y(),0.0,//1
            startPoint.x() + upperLBoardLength,startPoint.y() + rightLBoardLength,0.0,//2
            windowNum <=1 ? startPoint.x() + upperLBoardLength - lboardLHeight,startPoint.y() + rightLBoardLength :  startPoint.x() + upperLBoardLength - lboardLHeight,startPoint.y() + rightLBoardLength - lboardLHeight,0.0,//3
            startPoint.x() + upperLBoardLength - lboardLHeight,startPoint.y() + lboardLHeight,0.0 //4
        };
        pModelSpace->dynamicCall("AddPolyline(VerticesList)", LBoardStartPoint);
        //pPolyline->setProperty("Closed",true);
        if(windowNum > 1)
        {
            //画下框
            LBoardStartPoint = {
                startPoint.x() + lboardLHeight,startPoint.y() + leftLBoardLength - lboardLHeight,0.0,//1
                startPoint.x() + upperLBoardLength - lboardLHeight,startPoint.y() + rightLBoardLength - lboardLHeight,0.0,//2
                startPoint.x() + upperLBoardLength,startPoint.y() + rightLBoardLength,0.0,//3
                startPoint.x(),startPoint.y() + leftLBoardLength //4
            };
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", LBoardStartPoint);
            //pPolyline->setProperty("Closed",true);
        }
        break;
    case 2:

        if(windowNum <= 1)
        {
            LBoardStartPoint = DrawDoubleLSlot(startPoint,2,1);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", LBoardStartPoint);
            //pPolyline->setProperty("Closed",true);
            //画线1
            LBoardStartPoint = {startPoint.x(),startPoint.y(),0.0};
            LBoardEndPoint = {startPoint.x() ,startPoint.y() + leftLBoardLength,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", LBoardStartPoint,LBoardEndPoint);

            //画线2
            LBoardStartPoint = {startPoint.x() + lboardLHeight ,startPoint.y() + upperLBoardWidth,0.0};
            LBoardEndPoint = {startPoint.x() + lboardLHeight ,startPoint.y() + leftLBoardLength,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", LBoardStartPoint,LBoardEndPoint);

            //画线3
            LBoardStartPoint = {startPoint.x() ,startPoint.y() + leftLBoardLength,0.0};
            LBoardEndPoint = {startPoint.x() + lboardLHeight ,startPoint.y() + leftLBoardLength,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", LBoardStartPoint,LBoardEndPoint);
        }
        else
        {
            pos = 1;
            LBoardStartPoint = DrawDoubleLSlot(startPoint,2,pos);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", LBoardStartPoint);
            //pPolyline->setProperty("Closed",true);

            pos = -1 * pos;
            startPoint = QPointF(startPoint.x(),startPoint.y() + upperLBoardLength);
            LBoardStartPoint = DrawDoubleLSlot(startPoint,2,pos);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", LBoardStartPoint);
            //pPolyline->setProperty("Closed",true);

            //画线1
            LBoardStartPoint = {startPoint.x(),startPoint.y(),0.0};
            LBoardEndPoint = {startPoint.x() ,startPoint.y() - leftLBoardLength,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", LBoardStartPoint,LBoardEndPoint);

            //画线2
            LBoardStartPoint = {startPoint.x() + lboardLHeight ,startPoint.y() - lboardLHeight,0.0};
            LBoardEndPoint = {startPoint.x() + lboardLHeight ,startPoint.y() - leftLBoardLength + lboardLHeight,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", LBoardStartPoint,LBoardEndPoint);
        }
        break;
    default:
        break;
    }
}

//画门边整体
void DrawComponment::DrawEdge(QPointF startPoint,int view)
{
    float upperBoardLength = windowData->find("IDC_UPPER_BOARD_LENGTH")->second.toFloat();

    float plainEdgeLength = windowData->find("IDC_PLAIN_EDGE_LENGTH")->second.toFloat();
    float hidePlainEdgeLength = windowData->find("IDC_HIDE_PLAIN_EDGE_LENGTH")->second.toFloat();

    float plainEdgeWidth = windowData->find("IDC_PLAIN_EDGE_WIDTH")->second.toFloat();
    float hidePlainEdgeWidth = windowData->find("IDC_HIDE_PLAIN_EDGE_WIDTH")->second.toFloat();

    float plainEdgeHeight = windowData->find("IDC_PLAIN_EDGE_HEIGHT")->second.toFloat();
    float hidePlainEdgeHeight = windowData->find("IDC_HIDE_PLAIN_EDGE_HEIGHT")->second.toFloat();


    //补充
    float plainCoverEdgeWidth = windowData->find("IDC_PLAIN_COVER_EDGE_WIDTH")->second.toFloat();
    float hideCoverEdgeWidth = windowData->find("IDC_HIDE_COVER_EDGE_WIDTH")->second.toFloat();

    float plainCoverEdgeHeight = windowData->find("IDC_PLAIN_COVER_EDGE_HEIGHT")->second.toFloat();
    float hideCoverEdgeHeight = windowData->find("IDC_HIDE_COVER_EDGE_HEIGHT")->second.toFloat();

    float plainCoverEdgeLength = windowData->find("IDC_PLAIN_COVER_EDGE_LENGTH")->second.toFloat();

    float hidePlainEdgeSlotWidth = windowData->find("IDC_HIDE_PLAIN_EDGE_SLOT_WIDTH")->second.toFloat();

    float hidePlainEdgeSlotDept = windowData->find("IDC_HIDE_PLAIN_EDGE_SLOT_DEPT")->second.toFloat();
    float hideCoverEdgeCoverLength = windowData->find("IDC_HIDE_COVER_EDGE_COVER_LENGTH")->second.toFloat();
    float hideCoverEdgeCoverWidth = windowData->find("IDC_HIDE_COVER_EDGE_COVER_WIDTH")->second.toFloat();
    //float hideCoverEdgeCoverBumpLength = windowData->find("IDC_HIDE_COVER_EDGE_COVER_BUMP_LENGTH")->second.toFloat();
    float plainCoverEdgeCoverLength = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_LENGTH")->second.toFloat();
    float plainCoverEdgeCoverWidth = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_WIDTH")->second.toFloat();
   // float plainCoverEdgeCoverBumpLength = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_BUMP_LENGTH")->second.toFloat();
    float lboardLHeight = windowData->find("IDC_LBOARD_LHEIGHT")->second.toFloat();

    float windowNum = windowData->find("IDC_WINDOW_NUM")->second.toInt();
    float windowWidth = windowData->find("IDC_WINDOW_WIDTH")->second.toFloat();

    float bladeLength = windowData->find("IDC_BLADE_LENGTH")->second.toFloat();
    QAxObject* pPolyline;
    QVariantList edgeStartPoint,edgeEndPoint;
    int pos = 1;
    switch (view) {
    case 0:

        if(windowNum == 1)
        {
            //单窗户以右上角为基准点，其他相反
            //绘制隐形平门边
            pos = -1;
            startPoint = QPoint(startPoint.x(),startPoint.y());
            edgeStartPoint = DrawSingleEdge(startPoint,0,pos,0);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", edgeStartPoint);
            //pPolyline->setProperty("Closed",true);

            // 绘制平门边
            edgeEndPoint = DrawSingleEdge(QPointF(startPoint.x() - hidePlainEdgeWidth - bladeLength - plainEdgeWidth,startPoint.y()),0,pos,1);
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, plainEdgeWidth, plainEdgeHeight);

            //画线
            edgeStartPoint = {startPoint.x() + (float)pos * hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + (float)pos * (hidePlainEdgeWidth + bladeLength),startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);

            edgeStartPoint = {startPoint.x()  + (float)pos * hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x()  + (float)pos * (hidePlainEdgeWidth + bladeLength),startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);
        }
        else if(windowNum == 2)
        {
            //隐藏平门边
            edgeStartPoint =DrawSingleEdge(startPoint,0,1,0);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", edgeStartPoint);
            //pPolyline->setProperty("Closed",true);
            //画线
            edgeStartPoint = {startPoint.x() + hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + hidePlainEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);

            edgeStartPoint = {startPoint.x() + hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + hidePlainEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);
            //调整起始点
            startPoint = QPointF(startPoint.x()+ hidePlainEdgeWidth + bladeLength,startPoint.y());
            //平盖片门边
            edgeStartPoint = DrawSingleEdge(startPoint,0,-1,3);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", edgeStartPoint);
            //pPolyline->setProperty("Closed",true);
            //平门边
            float width = plainEdgeWidth, height = plainEdgeHeight;
            edgeStartPoint = {
                startPoint.x() + hidePlainEdgeWidth + bladeLength + plainEdgeWidth,startPoint.y(),0.0 //1
            };
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint,width,height);
            //隐藏平门边
            startPoint = QPointF(startPoint.x() + plainCoverEdgeWidth + plainEdgeWidth + bladeLength +hidePlainEdgeWidth,startPoint.y());
            edgeStartPoint = DrawSingleEdge(startPoint,0,-1,0);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", edgeStartPoint);
            //pPolyline->setProperty("Closed",true);
            //画线
            edgeStartPoint = {startPoint.x() - hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() - hidePlainEdgeWidth - bladeLength,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);
            edgeStartPoint = {startPoint.x() - hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() - hidePlainEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);


        }
        else if(windowNum == 3)
        {
            //隐藏平门边
            edgeStartPoint =DrawSingleEdge(startPoint,0,1,0);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", edgeStartPoint);
            //pPolyline->setProperty("Closed",true);
            //画线
            edgeStartPoint = {startPoint.x() + hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + hidePlainEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);

            edgeStartPoint = {startPoint.x() + hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + hidePlainEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);

            //平门边
            float width = plainEdgeWidth, height = plainEdgeHeight;
            edgeStartPoint = {
                startPoint.x() + hidePlainEdgeWidth + bladeLength,startPoint.y(),0.0 //1
            };
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint,width,height);

            //调整起始点
            startPoint = QPointF(startPoint.x()+ hidePlainEdgeWidth + bladeLength + plainEdgeWidth,startPoint.y());
            //隐藏平盖片门边
            edgeStartPoint = DrawSingleEdge(startPoint,0,1,2);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", edgeStartPoint);
            //pPolyline->setProperty("Closed",true);

            //画窗框线
            edgeStartPoint = {startPoint.x() + hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + hidePlainEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);

            edgeStartPoint = {startPoint.x() + hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + hidePlainEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);

            //平门边
            startPoint = QPointF(edgeEndPoint.first().toFloat(),startPoint.y());
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint,width,height);

            //平盖片门边
            startPoint =QPointF(startPoint.x() + width,startPoint.y());
            edgeStartPoint = DrawSingleEdge(startPoint,0,1,3);
            pModelSpace->dynamicCall("AddPolyline(VerticesList)", edgeStartPoint);
            //pPolyline->setProperty("Closed",true);

            //隐藏平门边
            startPoint =QPointF(startPoint.x() + plainCoverEdgeWidth + bladeLength + hidePlainEdgeWidth,startPoint.y());
            edgeStartPoint = DrawSingleEdge(startPoint,0,-1,0);
            //画窗框线
            edgeStartPoint = {startPoint.x() + plainCoverEdgeWidth,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + plainCoverEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight- hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);

            edgeStartPoint = {startPoint.x() + hidePlainEdgeWidth,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            edgeEndPoint = {startPoint.x() + hidePlainEdgeWidth + bladeLength,startPoint.y() + (hidePlainEdgeHeight+ hidePlainEdgeSlotWidth) / 2.0,0.0};
            pModelSpace->dynamicCall("AddLine(Variant, Variant)", edgeStartPoint, edgeEndPoint);
        }
        else
        {

        }

        break;
    case 1:
        if(windowNum == 1)
        {
            edgeStartPoint = {startPoint.x(),startPoint.y(),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, plainEdgeWidth, plainEdgeLength);
            edgeEndPoint = {edgeStartPoint.at(0).toFloat() + plainEdgeWidth +bladeLength,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, hidePlainEdgeWidth, hidePlainEdgeLength);
        }
        else if(windowNum == 2)
        {
            edgeStartPoint = {startPoint.x(),startPoint.y(),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, hidePlainEdgeWidth, hidePlainEdgeLength);
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + hidePlainEdgeWidth +bladeLength,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, plainCoverEdgeWidth, plainCoverEdgeLength);
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + plainCoverEdgeWidth,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, plainEdgeWidth, plainEdgeLength);
            edgeEndPoint = {edgeStartPoint.at(0).toFloat() + plainEdgeWidth + bladeLength,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, hidePlainEdgeWidth, plainEdgeLength);
        }
        else if(windowNum == 3)
        {
            edgeStartPoint = {startPoint.x(),startPoint.y(),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, hidePlainEdgeWidth, hidePlainEdgeLength);
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + hidePlainEdgeWidth +bladeLength,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, plainEdgeWidth, plainEdgeLength);
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + plainEdgeWidth,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, plainCoverEdgeWidth, plainCoverEdgeLength);
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + plainCoverEdgeWidth + bladeLength,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, plainEdgeWidth, plainEdgeLength);
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + plainEdgeWidth,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, plainCoverEdgeWidth, plainCoverEdgeLength);
            edgeEndPoint = {edgeStartPoint.at(0).toFloat() + plainCoverEdgeWidth + bladeLength,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, hidePlainEdgeWidth, plainEdgeLength);
        }
        else
        {

        }
        break;
     case 2:
        break;
    }
}

//画上下板整体
void DrawComponment::DrawBoard(QPointF startPoint,int view) {
    float upperBoardLength = windowData->find("IDC_UPPER_BOARD_LENGTH")->second.toFloat();
    float upperBoardWidth = windowData->find("IDC_UPPER_BOARD_WIDTH")->second.toFloat();

    float lowerBoardLength = windowData->find("IDC_LOWER_BOARD_LENGTH")->second.toFloat();
    float lowerBoardWidth = windowData->find("IDC_LOWER_BOARD_WIDTH")->second.toFloat();

    float plainEdgeLength = windowData->find("IDC_PLAIN_EDGE_LENGTH")->second.toFloat();
    float hidePlainEdgeLength = windowData->find("IDC_HIDE_PLAIN_EDGE_LENGTH")->second.toFloat();

    float plainEdgeWidth = windowData->find("IDC_PLAIN_EDGE_WIDTH")->second.toFloat();
    float hidePlainEdgeWidth = windowData->find("IDC_HIDE_PLAIN_EDGE_WIDTH")->second.toFloat();

    float plainEdgeHeight = windowData->find("IDC_PLAIN_EDGE_HEIGHT")->second.toFloat();
    float hidePlainEdgeHeight = windowData->find("IDC_HIDE_PLAIN_EDGE_HEIGHT")->second.toFloat();


    //补充
    float plainCoverEdgeWidth = windowData->find("IDC_PLAIN_COVER_EDGE_WIDTH")->second.toFloat();
    float hideCoverEdgeWidth = windowData->find("IDC_HIDE_COVER_EDGE_WIDTH")->second.toFloat();

    float plainCoverEdgeHeight = windowData->find("IDC_PLAIN_COVER_EDGE_HEIGHT")->second.toFloat();
    float hideCoverEdgeHeight = windowData->find("IDC_HIDE_COVER_EDGE_HEIGHT")->second.toFloat();

    float plainCoverEdgeLength = windowData->find("IDC_PLAIN_COVER_EDGE_LENGTH")->second.toFloat();

    float hidePlainEdgeSlotWidth = windowData->find("IDC_HIDE_PLAIN_EDGE_SLOT_WIDTH")->second.toFloat();

    float hidePlainEdgeSlotDept = windowData->find("IDC_HIDE_PLAIN_EDGE_SLOT_DEPT")->second.toFloat();
    float hideCoverEdgeCoverLength = windowData->find("IDC_HIDE_COVER_EDGE_COVER_LENGTH")->second.toFloat();
    float hideCoverEdgeCoverWidth = windowData->find("IDC_HIDE_COVER_EDGE_COVER_WIDTH")->second.toFloat();
    //float hideCoverEdgeCoverBumpLength = windowData->find("IDC_HIDE_COVER_EDGE_COVER_BUMP_LENGTH")->second.toFloat();
    float plainCoverEdgeCoverLength = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_LENGTH")->second.toFloat();
    float plainCoverEdgeCoverWidth = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_WIDTH")->second.toFloat();
   // float plainCoverEdgeCoverBumpLength = windowData->find("IDC_PLAIN_COVER_EDGE_COVER_BUMP_LENGTH")->second.toFloat();
    float lboardLHeight = windowData->find("IDC_LBOARD_LHEIGHT")->second.toFloat();

    float windowNum = windowData->find("IDC_WINDOW_NUM")->second.toInt();
    float windowWidth = windowData->find("IDC_WINDOW_WIDTH")->second.toFloat();

    float bladeLength = windowData->find("IDC_BLADE_LENGTH")->second.toFloat();
    QAxObject* pPolyline;
    QVariantList edgeStartPoint,edgeEndPoint;
    QVariantList upperBoardPoint,lowerBoardPoint;
    switch (view) {
    case 0:
        break;
    case 1:
        if(windowNum ==1)
        {
            edgeStartPoint = {startPoint.x(),startPoint.y(),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, upperBoardLength, upperBoardWidth);
            edgeEndPoint = {startPoint.x(),startPoint.y() + plainEdgeLength - lowerBoardWidth,0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, lowerBoardLength, lowerBoardWidth);
        }
        else if(windowNum == 2)
        {
            //左半部分
            edgeStartPoint = {startPoint.x(),startPoint.y(),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, upperBoardLength, upperBoardWidth);
            edgeEndPoint = {startPoint.x(),startPoint.y() + plainEdgeLength - lowerBoardWidth,0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, lowerBoardLength, lowerBoardWidth);

            //右半部份
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + bladeLength + plainCoverEdgeWidth + plainEdgeWidth,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, upperBoardLength, upperBoardWidth);
            edgeEndPoint = {edgeStartPoint.at(0),edgeStartPoint.at(1).toFloat() + plainEdgeLength - lowerBoardWidth,0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, lowerBoardLength, lowerBoardWidth);
        }
        else if(windowNum ==3)
        {
            //左半部分
            edgeStartPoint = {startPoint.x(),startPoint.y(),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, upperBoardLength, upperBoardWidth);
            edgeEndPoint = {startPoint.x(),startPoint.y() + plainEdgeLength - lowerBoardWidth,0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, lowerBoardLength, lowerBoardWidth);
            //中间部分
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + bladeLength + plainEdgeWidth + hideCoverEdgeWidth,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, upperBoardLength, upperBoardWidth);
            edgeEndPoint = {edgeStartPoint.at(0),edgeEndPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, lowerBoardLength, lowerBoardWidth);
            //右半部分
            edgeStartPoint = {edgeStartPoint.at(0).toFloat() + bladeLength + plainEdgeWidth + plainCoverEdgeWidth,edgeStartPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, upperBoardLength, upperBoardWidth);
            edgeEndPoint = {edgeStartPoint.at(0),edgeEndPoint.at(1),0.0};
            pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeEndPoint, lowerBoardLength, lowerBoardWidth);
        }
        break;
    case 2:
        //画上板
        upperBoardPoint = DrawSingleBoard(startPoint,2,1);
        pModelSpace->dynamicCall("AddPolyline(VerticesList)", upperBoardPoint);
        //pPolyline->setProperty("Closed",true);
        //画下板
        lowerBoardPoint = DrawSingleBoard(startPoint,2,-1);
        pModelSpace->dynamicCall("AddPolyline(VerticesList)", lowerBoardPoint);
        //pPolyline->setProperty("Closed",true);
        break;
    }
}

//画叶片
void DrawComponment::DrawLeaf(QPointF startPoint,int view)
{
    float bladeLength = windowData->find("IDC_BLADE_LENGTH")->second.toFloat();
    float bladeWidth = windowData->find("IDC_BLADE_WIDTH")->second.toFloat();
    float bladeHeight = windowData->find("IDC_BLADE_HEIGHT")->second.toFloat();
    float bladeNum = windowData->find("IDC_BLADE_NUM")->second.toFloat();
    float upperBoardWidth = windowData->find("IDC_UPPER_BOARD_WIDTH")->second.toFloat();
    float lowerBoardWidth = windowData->find("IDC_LOWER_BOARD_WIDTH")->second.toFloat();
    float upperBoardHeight = windowData->find("IDC_UPPER_BOARD_HEIGHT")->second.toFloat();
    float plainEdgeWidth = windowData->find("IDC_PLAIN_EDGE_WIDTH")->second.toFloat();
    float plainEdgeLength = windowData->find("IDC_PLAIN_EDGE_LENGTH")->second.toFloat();
    float plainEdgeHeight = windowData->find("IDC_PLAIN_EDGE_HEIGHT")->second.toFloat();
    float windowWidth = windowData->find("IDC_WINDOW_WIDTH")->second.toFloat();

    float hidePlainEdgeWidth = windowData->find("IDC_HIDE_PLAIN_EDGE_WIDTH")->second.toFloat();
    float hidePlainEdgeHeight = windowData->find("IDC_HIDE_PLAIN_EDGE_HEIGHT")->second.toFloat();
    //补充
    float plainCoverEdgeWidth = windowData->find("IDC_PLAIN_COVER_EDGE_WIDTH")->second.toFloat();
    float hideCoverEdgeWidth = windowData->find("IDC_HIDE_COVER_EDGE_WIDTH")->second.toFloat();

    QAxObject* ellipse;
    float height = (plainEdgeLength - upperBoardWidth - lowerBoardWidth) / bladeNum / 2.0;
    float angle =asin(height / (bladeWidth / 2.0));
    float centerX,centerY,mainAxisX,mainAxisY,subAxisX,subAxisY;
    QVariantList edgeStartPoint,edgeEndPoint;

    centerX = upperBoardHeight / 2.0;
    centerY = startPoint.y() + upperBoardWidth + height;
    mainAxisX = centerX + (bladeWidth / 2.0) * cos(angle);
    mainAxisY = centerY - height;
    subAxisX = centerX + cos(angle) * (bladeHeight / 2.0);
    subAxisY = centerY + sin(angle) * (bladeHeight / 2.0);
    switch(view)
    {
    case 1:
        if(windowNum == 1)
        {
            for(int i=0;i < bladeNum;i++)
            {
                edgeStartPoint = {startPoint.x(),startPoint.y() + i * height * 2.0,0.0};
                pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, bladeLength, 2.0 * height);
            }
        }
        else if(windowNum == 2)
        {
            for(int i=0;i < bladeNum;i++)
            {
                edgeStartPoint = {startPoint.x(),startPoint.y() + i * height * 2.0,0.0};
                pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, bladeLength, 2.0 * height);
            }
            edgeEndPoint = {startPoint.x() + windowWidth + plainCoverEdgeWidth + plainEdgeWidth ,startPoint.y(),0.0};
            for(int i=0;i < bladeNum;i++)
            {
                edgeStartPoint = {edgeEndPoint.at(0),edgeEndPoint.at(1).toFloat() + i * height * 2.0,0.0};
                pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, bladeLength, 2.0 * height);
            }
        }
        else if(windowNum == 3)
        {
            for(int i=0;i < bladeNum;i++)
            {
                edgeStartPoint = {startPoint.x(),startPoint.y() + i * height * 2.0,0.0};
                pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, bladeLength, 2.0 * height);
            }
            edgeEndPoint = {startPoint.x() + windowWidth + plainEdgeWidth +hideCoverEdgeWidth ,startPoint.y(),0.0};
            for(int i=0;i < bladeNum;i++)
            {
                edgeStartPoint = {edgeEndPoint.at(0),edgeEndPoint.at(1).toFloat() + i * height * 2.0,0.0};
                pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, bladeLength, 2.0 * height);
            }
            edgeEndPoint = {startPoint.x() + windowWidth +plainEdgeWidth + plainCoverEdgeWidth ,startPoint.y(),0.0};
            for(int i=0;i < bladeNum;i++)
            {
                edgeStartPoint = {edgeEndPoint.at(0),edgeEndPoint.at(1).toFloat() + i * height * 2.0,0.0};
                pModelSpace->dynamicCall("AddRectangle(Variant, double, double)", edgeStartPoint, bladeLength, 2.0 * height);
            }
        }
        break;
    case 2:

        for(int i =0;i < bladeNum;i++)
        {
            // 添加椭圆，参数依次为：中心点 X, Y, 主轴X,Y, 次轴,X,Y
            pModelSpace->dynamicCall("AddEllipse(double, double, double, double, double, double)",centerX, centerY + i * height, mainAxisX, mainAxisY+ i * height,subAxisX,subAxisY+ i * height);
        }
        break;
    }
}

//画合页
void DrawComponment::DrawHinge(QPointF startPoint,int view)
{

}
